import request from '@/router/axios';

/**
 * @param params 查询 生命周期列表
 * */
export const getList = (params) => {
    return request({
        url: '/api/state-api/life-cycle/page',
        method: 'get',
        params
    })
}

/**
 * @param params 查看 生命周期详情
 * */
export const getDetail = (params) => {
    return request({
        url: '/api/state-api/life-cycle/detail',
        method: 'get',
        params
    })
}

/**
 * @param data 新增 生命周期
 * */
export const save = (data) => {
    return request({
        url: '/api/state-api/life-cycle/save',
        method: 'post',
        data: data
    })
}

/**
 * @param data 编辑 生命周期
 * */
export const update = (data) => {
    return request({
        url: '/api/state-api/life-cycle/update',
        method: 'post',
        data: data
    })
}

/**
 * @param params 删除 生命周期
 * */
export const del = (params) => {
    return request({
        url: '/api/state-api/life-cycle/delete',
        method: 'post',
        params
    })
}

/**
 * @param data 启用 生命周期
 * */
export const start = (data) => {
    return request({
        url: '/api/state-api/life-cycle/startUsing',
        method: 'post',
        params: data
    })
}

/**
 * @param data 停用 生命周期
 * */
export const stop = (data) => {
    return request({
        url: '/api/state-api/life-cycle/stopUsing',
        method: 'post',
        params: data
    })
}

/**
 * 查询关联流程
 * */
export const flowTemplateList = () => {
    return request({
        url: '/api/state-api/life-cycle/flowTemplateList',
        method: 'get',
    })
}


/**
 * @param params 检出 生命周期
 * */
export const checkout = (params) => {
    return request({
        url: '/api/state-api/life-cycle/checkout',
        method: 'post',
        params
    })
}

/**
 * @param params 检入 生命周期
 * */
export const publish = (params) => {
    return request({
        url: '/api/state-api/life-cycle/checkin',
        method: 'post',
        params
    })
}

/**
 * @param params 撤销检出 生命周期
 * */
export const unCheckOut = (params) => {
    return request({
        url: '/api/state-api/life-cycle/revokeCheckout',
        method: 'post',
        params
    })
}
